package com.xintonghua.base.utils;

import android.text.TextUtils;

/**
 * Created by win7 on 2016/7/31.
 */
public class ProtocolUtils {

    public static boolean isHttpProtocol(String url) {
        return protocol(url, Protocol.HTTP);
    }

    public static boolean isHttpsProtocol(String url) {
        return protocol(url, Protocol.HTTPS);
    }


    public static boolean isWeb(String url) {
        return protocol(url, Protocol.HTTP) || protocol(url, Protocol.HTTPS);
    }

    public static boolean isWebProtocol(String url) {
        return isHttpProtocol(url) || isHttpsProtocol(url);
    }

    public static boolean isTelProtocol(String url) {
        return protocol(url, Protocol.TEL);
    }

    public static boolean protocol(String url, String protocol) {
        if (!TextUtils.isEmpty(url)) {
            return url.startsWith(protocol);
        }
        return false;
    }
}
